package com.hu.video.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebConfig implements WebMvcConfigurer {
    // 重写WebMvcConfigurer接口的addResourceHandlers方法，用于配置静态资源的访问路径
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        # 修改为自己的电脑绝对路径
        // 访问/static/video/**时，将映射到D:\qwer\backend\src\main\resources\static\video目录下的文件
        registry.addResourceHandler("/static/video/**")
                .addResourceLocations("file:D:\\qwer\\backend\\src\\main\\resources\\static\\video\\");
        registry.
                // 访问/static/uimages/**时，将映射到D:\qwer\backend\src\main\resources\static\vimages目录下的文件
                addResourceHandler("/static/uimages/**")
                .addResourceLocations("file:D:\\qwer\\backend\\src\\main\\resources\\static\\vimages\\");
    }
}
